<template>
  <div class="card easy-container">
    <div class="card-content">
      <accept-button @accepted="contribUpdated" />
      <close-button @closed="contribUpdated" />
      <span v-if="isWaitTip" class="info-deep m-l-16">请等待管理员审核</span>
    </div>
  </div>
</template>

<script>
import { mapState, mapGetters } from 'vuex';
import AcceptButton from './accept-button';
import CloseButton from './close-button';

export default {
  name: 'state-control-box',
  components: {
    AcceptButton,
    CloseButton,
  },
  computed: {
    ...mapState({
      curContrib: 'currentContribution',
    }),
    ...mapGetters(['isSpaceOwner', 'isSpaceAdmin']),
    isWaitTip() {
      return !(this.isSpaceOwner || this.isSpaceAdmin) // 不是管理员
        && !this.curContrib.closed // 未被关闭
        && !this.curContrib.accepted; // 未被接受
    },
  },
  methods: {
    contribUpdated() { this.$emit('updated'); },
  },
};
</script>

<style></style>
